package com.example.daliy.sync;

import org.springframework.util.StopWatch;

public class MySync {

    public static void main(String[] args) throws InterruptedException {
        Student s = new Student();

        StopWatch stopWatch = new StopWatch();
        stopWatch.start();
        Thread t1 = new Thread(() -> {
            for (int i = 0; i < 10000000; i++) {
                s.add();
            }
        });
        t1.start();

        for (int i = 0; i < 10000000; i++) {
            s.add();
        }
        t1.join();
        stopWatch.stop();
        System.out.println(s.getNum());
        System.out.println(stopWatch.getLastTaskTimeMillis());

    }

}
